package com.cloudkinto.enumType.order.outbound;

import com.baomidou.mybatisplus.core.enums.IEnum;
import com.cloudkinto.vo.common.CommonKvVo;

import java.util.ArrayList;

/**
 * @author long
 */

public enum OutboundVarietyTypeEnum implements IEnum<Integer> {

    /**
     *
     */
    one(1, "单品单件"),
    two(2, "单品多件"),
    three(3, "多品混合");

    private final Integer value;

    private final String desc;

    OutboundVarietyTypeEnum(Integer value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    @Override
    public Integer getValue() {
        return value;
    }

    public static ArrayList<CommonKvVo> getOrderVarietyTypeList() {
        ArrayList<CommonKvVo> list = new ArrayList<>();
        for (OutboundVarietyTypeEnum inboundType : values()) {
            list.add(
                    CommonKvVo.builder()
                            .label(inboundType.desc)
                            .value(inboundType.getValue())
                            .build()
            );
        }
        return list;
    }

    public static String getDescByValue(Integer value) {
        for (OutboundVarietyTypeEnum inboundType : values()) {
            if (inboundType.value.equals(value)) {
                return inboundType.desc;
            }
        }
        return null;
    }
}
